﻿using Koala.Pro.Core.Models;

namespace Koala.Pro.Helpers
{
    public class RoleAndDeptTreeNode : BaseTreeNode<RoleAndDeptTreeNode>
    {
        public string DeptId { get; set; }

        public string RoleId { get; set; }

        public string CompanyId { get; set; }

        public RoleAndDeptTreeNode()
        {
        }

        public RoleAndDeptTreeNode(OuInfo ouInfo, RoleAndDeptTreeNode parentNode = null)
        {
            base.Name = ouInfo.Name;
            base.Tag = null;
            base.Note = ouInfo.Category;
            if (ouInfo.Category == "集团" || ouInfo.Category == "公司")
            {
                CompanyId = ouInfo.Id.ToString();
            }
            else
            {
                CompanyId = ouInfo.Company_ID;
                DeptId = ouInfo.Id.ToString();
            }
            parentNode?.Children.Add(this);
        }
    }

}
